﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Parts_PartsAdd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        lbSuccess.Visible = false;

    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Part part = new Part();
        part.part_Description = txtPart_Description.Text;
        part.install_Date = DateTime.Parse(txtInstall_Date.Text);
        part.part_Serial = txtPart_Serial.Text;
        part.part_Type = txtPart_Type.Text;

        //Using the facade that has the business logic
        AssetConfig assetFac = new AssetConfig();
        assetFac.addPart(part);
        
        txtInstall_Date.Text = "";
        txtPart_Description.Text = "";
        txtPart_Serial.Text = "";
        txtPart_Type.Text = "";

        lbSuccess.Visible = true;

    }
    protected void btnCancle_Click(object sender, EventArgs e)
    {
        txtInstall_Date.Text = "";
        txtPart_Description.Text = "";
        txtPart_Serial.Text = "";
        txtPart_Type.Text = "";
    }
}